﻿@model Xms.Web.Models.PlatformSettingModel

<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title">
            <a data-toggle="collapse"
               href="#collapseTwo">
                <strong>@app.PrivilegeTree?.LastOrDefault().DisplayName</strong>
            </a>
        </h3>
    </div>
    <div class="panel-body">
        <form id="editform" class="form-horizontal" data-jsonajax="true" data-istip="true" action="/@(app.OrganizationUniqueName)/api/settings/platform" method="post">
            <div class="form-group col-sm-12">
                <label class="col-sm-2 control-label" for="AppName">应用名称</label>
                <div class="col-sm-10">
                    @Html.TextBoxFor(x => x.AppName, new { @class = "form-control required" })
                </div>
            </div>
            <div class="form-group col-sm-12">
                <label class="col-sm-2 control-label" for="AppVersion">版本号</label>
                <div class="col-sm-10">
                    @Html.TextBoxFor(x => x.AppVersion, new { @class = "form-control required" })
                </div>
            </div>
            <div class="form-group col-sm-12">
                <label class="col-sm-2 control-label" for="ShowMenuInUserPrivileges">按用户权限显示菜单</label>
                <div class="col-sm-10">
                    <label class="checkbox-inline">@Html.RadioButtonFor(x => x.ShowMenuInUserPrivileges, true) 是</label>
                    <label class="checkbox-inline">@Html.RadioButtonFor(x => x.ShowMenuInUserPrivileges, false) 否</label>
                </div>
            </div>
            <div class="form-group col-sm-12">
                <label class="col-sm-2 control-label" for="DataLogEnabled">数据日志</label>
                <div class="col-sm-10">
                    <label class="checkbox-inline">@Html.RadioButtonFor(x => x.DataLogEnabled, true) 启用</label>
                    <label class="checkbox-inline">@Html.RadioButtonFor(x => x.DataLogEnabled, false) 禁用</label>
                </div>
            </div>
            <div class="form-group col-sm-12">
                <label class="col-sm-2 control-label" for="LogEnabled">访问日志</label>
                <div class="col-sm-10">
                    <label class="checkbox-inline">@Html.RadioButtonFor(x => x.LogEnabled, true) 启用</label>
                    <label class="checkbox-inline">@Html.RadioButtonFor(x => x.LogEnabled, false) 禁用</label>
                </div>
            </div>
            <div class="form-group col-sm-12">
                <label class="col-sm-2 control-label" for="LogEnabled">登录验证码</label>
                <div class="col-sm-10">
                    <label class="checkbox-inline">@Html.RadioButtonFor(x => x.VerifyCodeEnabled, true) 启用</label>
                    <label class="checkbox-inline">@Html.RadioButtonFor(x => x.VerifyCodeEnabled, false) 禁用</label>
                </div>
            </div>
            <div class="form-group col-sm-12 hide">
                <label class="col-sm-2 control-label" for="loglevel">日志级别</label>
                <div class="col-sm-10">
                    <select class="form-control" name="loglevel" id="loglevel" data-value="@Model.LogLevel">
                        @*<option value="0">debug</option>*@
                        <option value="1">information</option>
                        <option value="2">warning</option>
                        <option value="3">error</option>
                    </select>
                </div>
            </div>
            <div class="form-group col-sm-12">
                <label class="col-sm-2 control-label" for="MaxFetchRecords">单页最大记录数</label>
                <div class="col-sm-10">
                    @Html.TextBoxFor(x => x.MaxFetchRecords, new { @class = "form-control required int", @data_range = "[1,25000]" })
                </div>
            </div>
            <div class="form-group col-sm-12">
                <label class="col-sm-2 control-label" for="CacheEnabled">是否启用缓存</label>
                <div class="col-sm-10">
                    <label class="checkbox-inline">@Html.RadioButtonFor(x => x.CacheEnabled, true) 启用</label>
                    <label class="checkbox-inline">@Html.RadioButtonFor(x => x.CacheEnabled, false) 禁用</label>
                </div>
            </div>
            <div class="form-group col-sm-12 text-center" id="form-buttons">
                <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-saved"></span> @app.T["save"]</button>
                <button type="reset" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span> @app.T["reset"]</button>
            </div>
        </form>
    </div>
</div>
@section Scripts {
    <script src="/content/js/jquery.form.js?v=@app.PlatformSettings.VersionNumber"></script>
    <script src="/content/js/jquery-validate/jquery.validate.min.js?v=@app.PlatformSettings.VersionNumber"></script>
    <script src="/content/js/jquery-validate/localization/messages_zh.min.js?v=@app.PlatformSettings.VersionNumber"></script>
    <script>
        $(function () {
            //表单验证
            var $form = $("#editform");
            Xms.Web.Form($form, function (response) {
                console.log(response);
                //Xms.Web.Toast(response.Content, response.IsSuccess);
            });
            $(".xmscheckbox").xmsCheckbox();
            Xms.Web.SelectedValue($('#loglevel'), $('#loglevel').data('value'));
        });
    </script>
}